package com.kingwang.training.designpattern.principles.lsp.shape;

import org.springframework.stereotype.Service;

@Service
public class ShapeService {
    public Double calculateAreaAndTest(Rectangle rectangle) throws Exception {
        rectangle.setWidth(5.0);
        rectangle.setHeight(4.0);

        Double area = rectangle.getArea();

        if (20 != area) {
            throw new Exception("Bad area!");
        }

        return area;
    }
}
